#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TableRaidRunMapWinConditionDao:DaoBase<TableRaidRunMapWinCondition>
    {
        public override string GetFileName()
        {
            return "TableRaidRunMapWinCondition.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimaryInt = new Dictionary<int, TableRaidRunMapWinCondition>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddOneIndex(TableRaidRunMapWinCondition model)
        {
            if (!cacheOneIndex.ContainsKey(model.runMapId.ToString()))
            {
                cacheOneIndex[model.runMapId.ToString()] = new List<TableRaidRunMapWinCondition>();
            }
            cacheOneIndex[model.runMapId.ToString()].Add(model);
        }
        public override void AddPrimaryIndex(TableRaidRunMapWinCondition model)
        {
            #if UNITY_EDITOR
            if(cachePrimaryInt.ContainsKey(model.storyConditionId)) UnityEngine.Debug.LogError("数据表id重复:TableRaidRunMapWinCondition->id: " + model.storyConditionId);
            #endif
            cachePrimaryInt[model.storyConditionId] = model;
        }
        protected override TableRaidRunMapWinCondition ParseRowData(string[] rowData)
        {
            TableRaidRunMapWinCondition data = new TableRaidRunMapWinCondition();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.storyConditionId = int.Parse(rowData[0]);
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.runMapId = int.Parse(rowData[1]);
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.winType = int.Parse(rowData[2]);
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.extraValue = int.Parse(rowData[3]);
            }
            if (!string.IsNullOrEmpty(rowData[4]))
            {
                data.title = rowData[4];
            }
            return data;
        }
    }
}
